<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Colorful Button</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <a href="#" class="btn">Awesome</a>
  <a href="#" class="btn">Button</a>
</body>
<script>
  let btn = document.querySelectorAll('.btn')

  btn.forEach(item => {
    item.onclick = function(e) {
      let x = e.pageX - e.target.offsetLeft
      let y = e.pageY - e.target.offsetTop
      let color = `#${Math.floor(Math.random() * 0xFFFFFF).toString(16)}`

      let ripples = document.createElement('span')

      ripples.style.left = x + 'px'
      ripples.style.top = y + 'px'
      ripples.style.borderColor = color

      this.appendChild(ripples)

      setTimeout(() => {
        ripples.remove()
      }, 2000)
    }
  })
</script>

</html>